package com.example.sa.myapp.login;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.example.sa.myapp.Home_Activity;
import com.example.sa.myapp.R;

public class Login extends AppCompatActivity implements View.OnClickListener{

    Intent intent;
    Toast toast;
    TextView tv_register;
    Button btn_login;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);

        tv_register = (TextView) findViewById(R.id.register);
        tv_register.setOnClickListener(this);
        btn_login = (Button) findViewById(R.id.btn_login);
        btn_login.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId())  {
            case R.id.btn_login :
                intent = new Intent(Login.this, Home_Activity.class);
                finish();
                startActivity(intent);
                break;
            case R.id.register :
                // toast.makeText(Login.this, "注册", Toast.LENGTH_SHORT).show();
                intent = new Intent(Login.this, RegisterActivity.class);
                startActivity(intent);
        }
    }
}
